<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>event</title>
</head>
<body>
<img src="img/bu.jpg" onclick="hi()" id="bu"/>
<img src="img/hu.jpg" id="hu"/>
<img src="img/ju.jpg" id="ju"/>
<script>
    function hi() {
        alert("bu")
    }

    var imgs = document.getElementsByTagName('img');
    imgs[1].onclick=function () {
        alert("hu")
    }
    imgs[2].addEventListener('click',function () {
        alert('ju')
    })
</script>
</body>
</html>